#!/bin/bash
#J.Zh.Wu Edit version 0.1
if [ $# -ne 2 ] ; then
echo "usage:---------------------------------"
echo "./creat_flags.sh id_name nstructe"
echo "for example: ./cmd_Human.sh T0003 20"
echo "---------------------------------------"
echo 
echo "exit!"
exit 1
fi

WorkHome="/public/home/users/qiang/FragHome/WorkHome"
PATH_ALL="/public/home/users/qiang/rosetta3"
PATH_ALL_TEST="$PATH_ALL/human"
#PATH_FASTA="$PATH_ALL/fasta"
cd $PATH_ALL_TEST
DIR_PATH="$PATH_ALL_TEST/$1/pdb"
cd $DIR_PATH

for((i=1;i<="$2";i++))
do
	for j in {0..31}
	do
	
		#create relax flags
	#-------add the relax option at there!------------------------------
		echo "-database $PATH_ALL/rosetta3_database" > r_flags"$i"_"$j" 
		echo "-wobblemoves" >> r_flags"$i"_"$j"
		echo "-constant_seed" >> r_flags"$i"_"$j"
	#for example	echo "XX" >>r_flags"$jj"
		echo "-relax::stage1_ramp_cycles 100">> r_flags"$i"_"$j"
		echo "-relax::min_tolerance 0.02">> r_flags"$i"_"$j"
		echo "-relax::stage2_cycles 100">> r_flags"$i"_"$j"
		echo "-relax::stage3_cycles 100">> r_flags"$i"_"$j"
		echo "-dun08">> r_flags"$i"_"$j"
              echo "-mute all">> r_flags"$i"_"$j"
		echo "-relax::cycle_ratio 10">> r_flags"$i"_"$j"
	#-------end---------------------------------------------------------	
		if [ "$i" -lt "10" ]; 
               then

			echo "-in:file:s S_000000"$i"_"$j".pdb" >> r_flags"$i"_"$j"
		elif [ "$i" -lt "100" ]; 
                 then

			echo "-in:file:s S_00000"$i"_"$j".pdb" >> r_flags"$i"_"$j"
		else
			echo "-in:file:s S_0000"$i"_"$j".pdb" >> r_flags"$i"_"$j"
		fi
	#end

	done

done
